package com.qiao.glod.ui.fragment;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.qiao.glod.R;

/**
 * Created by Qiao on 2016/4/8.
 * function：
 */
public class ChoiceFragment extends ListFragment {
    private String mTitle = "ChoiceFragment";


    public String getTitle(){
        return mTitle;
    }


    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        ListView listView = getListView();
        listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
        setListAdapter(new ArrayAdapter<String>(getContext(),
                R.layout.text_item, new String[]{"rew", "fda", "fas", "fda", "fas"
                , "fda", "fas"}));
    }

    @Override
    public void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        Log.e(getClass().getSimpleName(), "onListItemClick: " +
                getListView().getCheckedItemPosition());
    }
}
